home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15320 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.2 KB

  1. Path: news.magmacom.com!not-for-mail
  2. From: ezust@mag1.magmacom.com (Acme Instant Dehydrated Boulder Kit)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Is it OK to delete const *type pointers?
  5. Date: 4 Apr 1996 14:27:40 -0500
  6. Organization: Cloud-Zero, Canada
  7. Message-ID: <4k17rc$ltu@mag1.magmacom.com>
  8. References: <4jpq00$lhj@dub-news-svc-6.compuserve.com> <4k15m9$gf8@mag1.magmacom.com>
  9. NNTP-Posting-Host: mag1.magmacom.com
  10.  
  11. In article <4k15m9$gf8@mag1.magmacom.com>,
  12. Acme Instant Dehydrated Boulder Kit <ezust@mag1.magmacom.com> wrote:
  13. >
  14. >deleting a pointer to a constant object is, IMHO, something which should not
  15. >be allowed by the language. And it is also something which is not permitted
  16. >by some compilers. I understand why the language might allow it, and I
  17. >understand why it might not. I've tried it on compilers which allow it,
  18. >and I have tried it on compilers which don't.
  19. >
  20. >What I want to know is, IS THERE SOMETHING IN THE DRAFT STANDARD that
  21. >discusses this? If so, where should I go to find it? Is a compiler which
  22. >actively prevents you from deleting a pointer to constant memory going
  23. >against the draft standard, or is it consistent with the language spec?
  24. >
  25. >While people's opinions on this subject are interesting, I've already
  26. >discussed it to death with co-workers. I just want to know why some
  27. >compilers don't let you do it and others do.
  28.  
  29. I checked the draft standard myself and found what I think is the answer
  30. to my question...
  31.  
  32. In the section
  33.  5.3.5  Delete
  34.  
  35. it says this:
  36.  
  37. 4 It is unspecified whether the deletion of an object changes its value.
  38.  
  39. If I interpret this the way I think I should, what this means is that in
  40. theory it is okay to delete a pointer to constant memory, but compilers
  41. can conform to the standard by generating an error, warning, or just
  42. compiling it without any warning or error. Am I right?
  43.  
  44. Why doesn't something get added to the draft standard which emphatically
  45. states whether this should be permitted or not? It seems rather silly to
  46. leave this unspecified...
  47.  
  48.  
  49. -- 
  50. Alan Ezust                       "Just because I work for the federal
  51. Ottawa, Canada                    government doesn't mean I'm an expert
  52. ezust@magmacom.com                on cockroaches"  -Special Agent Fox Mulder
  53. http://www2.magmacom.com/~ezust   
  54.